//
//  SWSegmentedControl.h
//  greenbuilding
//
//  Created by lvjian01 on 2017/9/12.
//  Copyright © 2017年 greenbuilding. All rights reserved.
//

#import <UIKit/UIKit.h>

@protocol SWSegmentedControlDelegate <NSObject>

- (void)segumentSelectionChange:(NSInteger)selection;

@end

@interface SWSegmentedControl : UIView

@property (nonatomic, strong) id<SWSegmentedControlDelegate> delegate;

/**
 标题集合
 */
@property (nonatomic, strong) NSArray *titleSource;

/**
 标题颜色
 */
@property (nonatomic, strong) UIColor *titleColor;

/**
 选中颜色
 */
@property (nonatomic, strong) UIColor *selectColor;

/**
 标题大小
 */
@property (nonatomic, strong) UIFont *titleFont;

/**
 下划线颜色
 */
@property (nonatomic, strong) UIColor *bottomColor;
 
/**
 下划线背景色
 */
@property (nonatomic, strong) UIColor *bottomLineColor;

/**
 选中下标
 */
@property (nonatomic, assign) NSInteger selectSegument;

/**
 是否动画切换
 */
@property (nonatomic, assign) NSInteger isAnimated;

+ (SWSegmentedControl *)segmentedControlFram:(CGRect)frame titleDataSource:(NSArray *)titleDataSource delegate:(id<SWSegmentedControlDelegate>)delegate;

+ (SWSegmentedControl *)segmentedControlFrame:(CGRect)frame titleDataSource:(NSArray *)titleDataSource backgroundColor:(UIColor *)backgroundColor titleColor:(UIColor *)titleColor titleFont:(UIFont *)titleFont selectColor:(UIColor *)selectColor bottomColor:(UIColor *)bottomColor delegate:(id<SWSegmentedControlDelegate>)delegate;

- (void)segmentedControl:(NSArray *)titleDataSource delegate:(id<SWSegmentedControlDelegate>)delegate;

- (void)segmentedControl:(NSArray *)titleDataSource backgroundColor:(UIColor *)backgroundColor titleColor:(UIColor *)titleColor titleFont:(UIFont *)titleFont selectColor:(UIColor *)selectColor bottomColor:(UIColor *)bottomColor delegate:(id<SWSegmentedControlDelegate>)delegate;

- (void)selectSegementAtIndex:(NSInteger)index;

@end
